<?php
/**
 * @package orinoco.framework
 * @subpackage framework
 * @author Ryan Yonzon <rawswift@gmail.com>
 * @copyright Copyright 2008 Ryan Yonzon 
 * @license http://www.opensource.org/licenses/mit-license.php MIT License
 */

require('view.core.php');

/**
 * handles application's controller and methods
 */
class coreController extends coreView {

	private $_app_controller_file;
	
	/**
	 * check if controller file exists
	 *
	 * @return bool true if file exists, otherwise false
	 */
	protected function isControllerFileExists() {
		$this->_app_controller_file =  APPLICATION_DIR . $this->_application . '/' . CONTROLLER_DIR . $this->_controller . CONTROLLER_FILE_SUFFIX . CONTROLLER_FILE_EXTENSION;
		if (!file_exists($this->_app_controller_file)) {
			return false;
		}
		return true;
	}
	
	/**
	 * check if method exists
	 *
	 * @return bool true if file exists, otherwise false
	 */
	protected function isMethodExists() {
		if(!is_callable(array($this->_controller . CONTROLLER_SUFFIX, $this->_method))) {
			return false;
		}
		return true;
	}

	/**
	 * returns controller's absolute file path
	 *
	 * @return string absolute file path
	 */
	protected function getControllerFilePath() {
		return $this->_app_controller_file;
	}
	
} // end class

// -EOF-